<template>
  <div>
    <f7-list no-hairlines-md class="ckeditor-content-title" v-if="titlenone != true">
      <li class="item-content">
        <div class="item-inner">
          <div class="item-title item-label">{{ title ? title : '内容' }}</div>
        </div>
      </li>
    </f7-list>
    <div style="padding: 0px 16px 16px 16px;min-height: 100px;">
      <div class="content gonggao_add_content detail-content" @click="toCkeditorPage">
        <div v-if="content==''" class="tacenter"
             style="line-height: 100px;background-color: rgba(0,0,0,0.12);">
          点击编辑内容
        </div>
        <div class="ckeditor-not-null-content" v-if="content!=''"
             v-html="content" style="min-height: 100px;"></div>
      </div>
    </div>
  </div>
</template>

<script>
  import Utils from '../../js/mod.utils';
  import Storage from '../../mod/storage';
  import StringUtils from '../../js/mod.string';

  export default {
    props: ['from', 'title', 'placeholder', 'content', 'titlenone'],
    data() {
      return {}
    },
    watch: {
      content() {
        console.log(this.content);
      },
    },
    methods: {
      toCkeditorPage: function () {
        var _this = this;
        var editorCont = _this.content;
        // var locData = {
        //   from: _this.from,
        //   editorCont: editorCont
        // };
        let locData = {
          from: _this.from,
          editorCont: editorCont,
          // type: 'add',
        };
        Storage.updateLocalDataByModule('ckeditor-content', locData);
        Storage.set('sd_ckeditor_content', StringUtils.toStr(locData));
        var data = {
          from: _this.from
        };
        Utils.load(_this, '/ckeditorPage/', data, {});
      },
    }
  }
</script>

<style scoped>
</style>
